package com.cn.xiongmeng.czlxz.taku;

import android.app.Activity;

import com.anythink.interstitial.api.ATInterstitial;

import com.cn.xiongmeng.czlxz.MainApplication;

public class InterstitialAd {
    /* 本类，只提供展示插屏广告的代码
    * 插屏广告初始化函数定义在MainApplication中
    * 插屏广告初始化函数调用在MainActivity中*/

    public static void showInterstitialAd(Activity activity){
        MainApplication app = (MainApplication)(activity.getApplication());
        ATInterstitial mInterstitialAd = app.getInterstitialAd();

        if (mInterstitialAd == null){
            return;
        }

        if (mInterstitialAd.isAdReady()) {
            mInterstitialAd.show(activity);
        } else {
            mInterstitialAd.load(); // 异步的，所以执行load后立即判断isAdReady是没有意义的
        }
    }

}
